/**
* Joel Filipe Antunes Cordeiro Nº 2006124250
* 
**/

/*
* validação do menu de adicionar utilizador
*/

  function register(id){
		 var form = document.getElementById(id);
		 
		 if(form.name.value==""){
		 	window.alert("Fill the Name field");
			form.name.focus();
		 } else if  (form.e_mail.value==""){
		    window.alert("Fill the E-Mail field");	        
  	        form.e_mail.focus();
		 } else if (form.username.value==""){
		    window.alert("Fill the Username field");
			form.username.focus();
		 } else if  (form.address.value==""){
			window.alert("Fill the Address field");	        
	  	    form.address.focus();			 
	     } else if (form.password.value==""){
		    window.alert("Fill the Password field");
			form.password.focus();
	     } else if (form.confirm_password.value==""){
		    window.alert("Fill the confirm password field");
  		    form.confirm_password.focus();
	     } else if  (form.e_mail.value.indexOf('@')==-1 || form.e_mail.value.indexOf('.')==-1){
		    window.alert("Invalid e-mail");	        
  	        form.e_mail.focus();	
	     } else if(form.password.value != form.confirm_password.value) {
	    	window.alert("The confirm password field is not equal to the password field.");	        
	        form.confirm_password.focus();	
	     } else {	    	 
	    	 form.submit();
	     }		
}